<%@ page import="com.tlc.bean.Book" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>修改</title>
    <style>
        body {
            background-color: darkkhaki;
        }

        table {
            position: relative;
            margin-top: 50px;
            background-color: coral;
        }

        .p1 {
            text-align: center;
            font-size: 25px;
        }

        .p2 {
            height: 35px;
            width: 35px;
        }

        #b1 {
            left: 25px;
        }

        #b2 {
            right: 25px;
        }

        #b3 {
            left: 225px;
        }

        #b1,
        #b2,
        #b3 {
            bottom: 15px;
            height: 28px;
            width: 50px;
            position: absolute;
            bottom: 10px;
        }
    </style>
</head>

<body>
<table border="2px" cellpadding="5px" cellspacing="5px" align="center">
    <form action="BookServlet?method=changeBook&currentPage=${crrentPage}&pageSize=${pageSize}" method="post" name="ch" enctype="multipart/form-data">
        <tr>
            <td colspan="2" class="p1" >修改图书</td>
        </tr>
        <tr>
            <td>请输入书ID：</td>
            <td><input type="number" name="sid" value="${book.sid}"></td>
        </tr>
        <tr>
            <td>请输入书名：</td>
            <td><input type="text" name="name" value="${book.sname}"></td>
        </tr>
        <tr>
            <td>请输入价格：</td>
            <td><input type="text" name="price" value="${book.price}"></td>
        </tr>
        <tr>
            <td>新书的作者：</td>
            <td><input type="text" name="auther" value="${book.auther}"></td>
        </tr>
        <tr>
            <td>图书出版社：</td>
            <td><input type="text" name="phouse" value="${book.phouse}"></td>
        </tr>
        <tr>
            <td>请输入出版日期：</td>
            <td><input type="text" name="dtime" value="${book.dtime}"></td>
        </tr>
        <tr>
            <td>图书的数量：</td>
            <td><input type="text" name="bcount" value="${book.bcount}"></td>
        </tr>
        <tr>
            <td>销售状态：</td>
            <td>
                <input type="radio" value="非卖品" name="nsale" ${"非卖品" eq book.nsale ? "checked" : ""}>非卖品
                <input type="radio" value="在售" name="nsale" ${"在售" eq book.nsale ? "checked" : ""}>在售
            </td>
        </tr>
        <tr>
            <td>图书种类：</td>
            <td>
                <select name="clas" id="cl">
                    <option value="0">图书种类</option>
                    <option value="1" ${"1" eq book.classify ? "selected" : ""}>小说</option>
                    <option value="2" ${"2" eq book.classify ? "selected" : ""}>儿童读物</option>
                    <option value="3" ${"3" eq book.classify ? "selected" : ""}>摄影绘画</option>
                    <option value="4" ${"4" eq book.classify ? "selected" : ""}>非小说类</option>
                    <option value="5" ${"5" eq book.classify ? "selected" : ""}>科技类</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>支持语言：</td>
            <td>
                <input type="checkbox" <c:if test="${fn:contains(book.lang,'汉语')}">checked</c:if> name = "lang" value="汉语">汉语
                <input type="checkbox" <c:if test="${fn:contains(book.lang, '英语')}">checked</c:if> name = "lang" value="英语">英语
                <input type="checkbox" <c:if test="${fn:contains(book.lang, '法语')}">checked</c:if> name = "lang" value="法语">法语
                <input type="checkbox" <c:if test="${fn:contains(book.lang, '俄语')}">checked</c:if> name = "lang" value="俄语">俄语
            </td>
        </tr>
        <tr>
            <td>图书封面：</td>
            <td>
                <img src="/image/${book.cover}" width="80px" height="60px">
                <input type="file" name="cover">
                <input type="hidden" name="oldcover" value="${book.cover}">
            </td>
        </tr>
        <tr>
            <td colspan="2" class="p2">
                <input type="submit" value="修改" id="b1">
                <input type="reset" value="重置" id="b2">
                <input type="button" value="返回" id="b3" onclick="history.back()">
            </td>
        </tr>
    </form>
</table>
<script>
    function validate() {
        if(ch.lang.value == null) {
            alert("语种不能为空！")
        }
    }
</script>
</body>
</html>
